//
//  KLLandMark.swift
//  SwiftUIDemo
//
//  Created by Kael on 2019/11/4.
//  Copyright © 2019 Kael. All rights reserved.
//

import SwiftUI

struct KLLandMarkRow: View {
    
    @State var userName : String = "KaeLinda"
    @State var userDes : String = "我是一名程序媛"
    @State var workAge : String = "我有20年工作经验"

    
    var body: some View {
        HStack{
            Spacer()
                .frame(width: 20, height: 10, alignment: .leading)
            Image("girl")
                .frame(width: 40, height: 60)
                .scaleEffect(0.3)
                .shadow(color: .red, radius: 3, x: -2, y: 2)

            VStack {
                HStack {
                    Text("\(userName)")
                        .font(.headline)
                    Spacer()
                }
                    .accentColor(.red)

                HStack {
                    Text("\(userDes)")
                        .font(.system(size: 12))
                    Spacer()
                }
            }
//            .frame(width: 150, height: 40, alignment: .leading)
                .frame(minWidth: 80, idealWidth: 120, maxWidth: 150, minHeight: 40, idealHeight: 40, maxHeight: 40, alignment: .leading)
            
            Spacer()
            
            Group {
                Text("\(workAge)")
                    .font(.system(size: 12))
                    .frame(minWidth: 40, idealWidth: 60, maxWidth: 120, minHeight: 40, idealHeight: 40, maxHeight: 40, alignment: .trailing)
            }
//            .frame(width: 150, height: 40, alignment: .bottom)
                .frame(minWidth: 40, idealWidth: 60, maxWidth: 120, minHeight: 40, idealHeight: 40, maxHeight: 40, alignment: .bottom)
            Spacer()
                .frame(width: 10, height: 20, alignment: .bottomTrailing)
        }
            .accentColor(.red)
    }
}

struct KLLandMarkRow_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            KLLandMarkRow(userName: "kael01", userDes: "这是一个神器的生程序媛", workAge: "我欲因之梦吴越，一夜飞度镜湖月")
            KLLandMarkRow(userName: "kael02", userDes: "这是一个神器的生程序媛", workAge: "我欲因之梦吴越，一夜飞度镜湖月")
            KLLandMarkRow(userName: "kael03", userDes: "这是一个神器的生程序媛", workAge: "我欲因之梦吴越，一夜飞度镜湖月")
        }
            .previewLayout(.fixed(width: 414, height: 70))
    }
}
